﻿<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:devlive="http://dev.live.com">
<head>
    <title></title>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <script type="text/javascript" src="http://controls.services.live.com/scripts/base/v0.3/live.js"></script>
    <script type="text/javascript" src="http://controls.services.live.com/scripts/base/v0.3/controls.js"></script>    
    <script type="text/javascript">
        function navFrame() {
            var s = document.location.href;
            s = s.substr(0,s.length - document.location.hash.length) + 
                "#" + 
                encodeURIComponent("http://" + document.getElementById('myAddress').value.replace("http://", ""));
            document.location.replace(s);
            document.location.reload();
        }

        function getWindowWidth(){
            if(window.innerWidth) return window.innerWidth;
            if(document.documentElement && document.documentElement.clientWidth)return document.documentElement.clientWidth;
            if(document.body && document.body.clientWidth)return document.body.clientWidth;
            return 0;
        }

        function getWindowHeight(){
            if(window.innerHeight) return window.innerHeight;
            if(document.documentElement && document.documentElement.clientHeight)return document.documentElement.clientHeight;
            if(document.body && document.body.clientHeight)return document.body.clientHeight;
            return 0;
        }
        
        function winResize() {
            elAdrss.style.width=(getWindowWidth() - 200) + 'px';
            elFrame.style.width=(getWindowWidth() - elCntct.style.width.replace("px","") - 10) + 'px';
            elFrame.style.height= elCntct.style.height=(getWindowHeight() - 100) + 'px';
        }
    </script>
</head>
<body onload='winResize();' onresize='winResize();'>
    <p>This is a 'share what I'm browsing' concept application. It does not work end to end, but it gives you an idea of the promise.</p>
    <br /> 
    <br /> 
<!--    
    <input 
        type='button'
        value='Friends'
        style='float:right'
        onclick='if (elCntct.style.width == "0px") {elCntct.style.width = "300px";winResize();} else {elCntct.style.width = "0px";winResize();}'
        />
-->
    Address:
    <input 
        type='text' 
        id='myAddress' 
        value='http://www.microsoft.com' />
    <input
        type='button'
        id='myGo'
        value='Go'
        onclick='navFrame();' />
    <br />
    <devlive:contactscontrol 
        id="ContactsControl"
        style='width:300px;right:0px;position:absolute;'
        devlive:view="tile"
        devlive:channelEndpointURL="channel.htm" 
    ></devlive:contactscontrol>
    <iframe 
        id='myFrame'
        style='width:1px;height:1px'
        src='http://www.microsoft.com'>
    </iframe>
    <script type="text/jscript">
        var elAdrss = document.getElementById('myAddress');
        var elFrame = document.getElementById('myFrame');
        var elCntct = document.getElementById('ContactsControl')
        if (document.location.hash.length > 1) {
            var sUrl = decodeURIComponent(document.location.hash.substr(1));
            elAdrss.value = sUrl;
            elCntct.setAttribute("message", "Come see " + sUrl);
            elFrame.setAttribute("src", sUrl);
        }
    </script>
</body>
</html>
